package org.whuims.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.data.solr.core.mapping.SolrDocument;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Created by Qikai on 2016/12/12.
 */

@Entity
@Table(name = "std_infor")
@SolrDocument(solrCoreName = "std_infor")
public class Infor extends IdEntity {
    private String title;
    private String content;
    private Date publishDate;
    private User author;
    private int type;
    @JsonIgnore
    private List<Comment> comments;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    @ManyToOne
    @JoinColumn(name = "author_id")
    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    @OneToMany(mappedBy = "infor")
    public List<Comment> getComments() {
        return comments;
    }

    public void setComments(List<Comment> comments) {
        this.comments = comments;
    }
}
